<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="container">

    <span>{{counter}}</span>

    <button @click="increment">add</button>
    <button @click="decrement">sub</button>

</div>

<script src="https://unpkg.com/vue@next"></script>
<script type="text/javascript">

    const demoApp = {
        data(){
            return {
                counter: 1
            }
        },
        mounted(){

        },
        methods:{
            increment(){
                this.$data.counter++ // 此处可以通过$data实例访问
            },
            decrement(){
                this.counter--
            }
        }
    }

    Vue.createApp(demoApp).mount('#container')
</script>

</body>
</html>
